package demo4;

class Student {
    public String name;
    public int age;
    public Student() {

    }
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void show() {
        System.out.println("姓名 :" + this.name + " 年龄: " + this.age);
    }
}
class Undergraduate extends Student{
    public String degree;
    public Undergraduate(String name, int age, String degree) {
        super(name,age);
        this.degree = degree;
    }

    @Override
    public void show() {
        System.out.println("姓名 :" + super.name + " 年龄: " + super.age + " 学位: " +
                this.degree);
    }
}
public class Test {
    public static void main(String[] args) {
        Student student = new Student("张三",28);
        student.show();
        Student student1 = new Undergraduate("李四",30,"硕士");
        student1.show();
    }
}
